import request from '@/untils/request'


export const getDaily = (pageNum = 1, pageSize = 15, title = '') => {
  return request({
    url: `/daily/selectDaily`,
    method: 'GET',
    params: {
      pageNum: pageNum,
      pageSize: pageSize,
      title: title
    }
  })
}

export const getDailyViewId = (id) => {
  return request({
    url: `/daily/selectDailyViewId/${id}`,
    method: 'GET',
  })
}

//下载为txt
export const downloadDailyTxtFile = (id) => {
  return request({
    url: `/daily/download-txt/${id}`,
    method: 'GET',
    responseType: 'blob' // 重要：设置响应类型为 blob，以便处理二进制数据
  })
}

export const getDailyData = (pageNum = 1, pageSize = 15, dailyId = '') => {
  return request({
    url: `/daily/selectDailyData`,
    method: 'GET',
    params: {
      pageNum: pageNum,
      pageSize: pageSize,
      dailyId: dailyId
    }
  })
}

//用户发布的
export const getUserSendDaily = (id) => {
  return request({
    url: `/daily/myDaily/${id}`,
    method: 'GET'
  })
}

//团队发布的日报内容
export const getTeamSendDaily = (employeeId,departmentId) => {
  return request({
    url: `/daily/teamDaily/${employeeId}/${departmentId}`,
    method: 'GET'
  })
}


//发送日报
export const addDaily = (data) => {
  return request({
    url: `/daily/addDaily`,
    method: 'POST',
    data: data
  })
}